package com.skyvin.nreceipts.common.mapper;

import java.util.ArrayList;
import java.util.List;

import org.springframework.data.domain.Page;

import com.skyvin.nreceipts.common.document.ReceiptCategoryTemplate;
import com.skyvin.nreceipts.common.dto.ReceiptCategoryDTO;

public class ReceiptCategoryMapper {
	public static ReceiptCategoryDTO map(ReceiptCategoryTemplate receiptCategory) {
		ReceiptCategoryDTO receiptCategoryDTO = new ReceiptCategoryDTO();
		receiptCategoryDTO.setId(receiptCategory.getId());
		receiptCategoryDTO.setValue(receiptCategory.getValue());
		return receiptCategoryDTO;
	}
	
	public static List<ReceiptCategoryDTO> map(Page<ReceiptCategoryTemplate> receiptCategoryDocuments) {
		List<ReceiptCategoryDTO> receiptCategoryDTOs = new ArrayList<ReceiptCategoryDTO>();
		for (ReceiptCategoryTemplate receiptCategory : receiptCategoryDocuments) {
			receiptCategoryDTOs.add(map(receiptCategory));
		}
		return receiptCategoryDTOs;
	}
}
